package com.platform.modules.sys.service.impl;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.platform.common.annotation.RedisCache;
import com.platform.common.utils.JedisUtil;
import com.platform.common.utils.Query;
import com.platform.modules.sys.dao.SysAptitudeExtDao;
import com.platform.modules.sys.entity.SysAptitudeExtEntity;
import com.platform.modules.sys.entity.SysOrgAptitudeEntity;
import com.platform.modules.sys.service.SysAptitudeExtService;

/**
 * 数据字典Service实现类
 *
 * @author 肖亮
 */
@Service("SysAptitudeExtService")
public class SysAptitudeExtServiceImpl extends ServiceImpl<SysAptitudeExtDao, SysAptitudeExtEntity> implements SysAptitudeExtService {
	@Autowired
	JedisUtil jedisUtil;

	@Override
	public List<SysAptitudeExtEntity> queryAll(Map<String, Object> params) {
		return baseMapper.queryAll(params);
	}

	@Override
	public Page queryPage(Map<String, Object> params) {
		Page<SysAptitudeExtEntity> page = new Query<SysAptitudeExtEntity>(params).getPage();
		return page.setRecords(baseMapper.selectListPage(page,params));
	}

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void update(SysAptitudeExtEntity sysAptitudeExtEntity) {
		this.updateById(sysAptitudeExtEntity);
		jedisUtil.delByClass(this.getClass().getName(), "queryAll");
	}

	@Override
	public void delete(String id) {
		this.removeById(id);
		jedisUtil.delByClass(this.getClass().getName(), "queryAll");
	}

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void deleteBatch(String[] ids) {
		this.removeByIds(Arrays.asList(ids));
		jedisUtil.delByClass(this.getClass().getName(), "queryAll");
	}
	
	@Override
	@Transactional(rollbackFor = Exception.class)
	public void deleteByColumnMap(Map<String, Object> params) {
		this.removeByMap(params);
	}

}
